package xyz.yuzegod.megawalls.listener;

import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemMergeEvent;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import xyz.yuzegod.megawalls.MegaWalls;

public class EffectListener extends BaseListener
{
    public EffectListener(final MegaWalls plugin) {
        super(plugin);
    }
    
    @EventHandler
    public void onEntityChangeBlock(final EntityChangeBlockEvent e) {
        if (e.getEntity().hasMetadata(MegaWalls.getMetadataValue())) {
            e.setCancelled(true);
        }
    }
    
    @EventHandler
    public void onPlayerInteractEntity(final PlayerInteractEntityEvent e) {
        if (e.getRightClicked().hasMetadata(MegaWalls.getMetadataValue())) {
            e.setCancelled(true);
        }
    }
    
    @EventHandler
    public void onPlayerInteractAtEntity(final PlayerInteractAtEntityEvent e) {
        if (e.getRightClicked().hasMetadata(MegaWalls.getMetadataValue())) {
            e.setCancelled(true);
        }
    }
    
    @EventHandler
    public void onPlayerArmorStandManipulateEvent(final PlayerArmorStandManipulateEvent e) {
        if (e.getRightClicked().hasMetadata(MegaWalls.getMetadataValue())) {
            e.setCancelled(true);
        }
    }
    
    @EventHandler
    public void onPlayerPickupItem(final PlayerPickupItemEvent e) {
        if (e.getItem().hasMetadata(MegaWalls.getMetadataValue())) {
            e.setCancelled(true);
        }
    }
    
    @EventHandler
    public void onItemMerge(final ItemMergeEvent e) {
        if (e.getEntity().hasMetadata(MegaWalls.getMetadataValue())) {
            e.setCancelled(true);
        }
    }
}
